<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>无标题文档</title>
  <link href="../../css/style.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="../../js/jquery.js"></script>
  <script type="text/javascript" src="../../js/axios.js"></script>
  <script type="text/javascript" src="../../js/api.js"></script>
  <script type="text/javascript" src="../../js/getParameter.js"></script>
  <link rel="stylesheet" href="../../layui/css/layui.css">
  <script type="text/javascript" src="../../layui/layui.js"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>数据统计</li>
    <li>入库统计</li>
    <li>入库详情</li>
  </ul>
</div>
<div class="rightinfo">
  <form action="" method="post">
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>仓库名称</th>
          <th>采购单编号</th>
          <th>商品数量</th>
          <th>金额</th>
          <th>入库时间</th>
          <th>入库人</th>
          <th>采购单详情</th>
        </tr>
      </thead>
      <tbody id="tb">
        <!--<tr>
          <td>1</td>
          <td>南京21号仓库</td>
          <td>CG201701270001</td>
          <td>5</td>
          <td>￥76,582</td>
          <td>2017-01-25 15:05:05</td>
          <td>马云</td>
          <td>
          	<a href="../../storage/stock/stockView.html" class="tablelink">查看详情</a>
          </td>
        </tr>-->

      </tbody>
    </table>
    <div class="pagin" id="page">
      <!--<div class="message">共<i class="blue">1256</i>条记录，当前显示第&nbsp;<i class="blue">2&nbsp;</i>页</div>
      <ul class="paginList">
        <li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>
        <li class="paginItem"><a href="javascript:;">1</a></li>
        <li class="paginItem current"><a href="javascript:;">2</a></li>
        <li class="paginItem"><a href="javascript:;">3</a></li>
        <li class="paginItem"><a href="javascript:;">4</a></li>
        <li class="paginItem"><a href="javascript:;">5</a></li>
        <li class="paginItem more"><a href="javascript:;">...</a></li>
        <li class="paginItem"><a href="javascript:;">10</a></li>
        <li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>
      </ul>-->
    </div>
  </form>
</div>
<script type="text/javascript">
    var totalcount;
    var pagesize = 8;
    var pagenum = 1;

    $(function () {
      load(pagenum,pagesize);
    })
    function load(pagenum,pagesize) {
      let str = "";
      var id = getParameter("id");
      /*console.log("id是："+id);*/


      axiosJson("get", "/census/queryInStoreDetail",null,{id: id,pagenum:pagenum,pagesize:pagesize}).then(res => {
        totalcount = res.data.totalCount;
        pagesize = res.data.pageSize;
        pagenum = res.data.pageNum;

        res = res.data;
        /*console.log("axiso:"+id);*/
        for (let i = 0; i < res.data.length; i++) {
          var rel = res.data[i];
          str += '<tr>\n' +
                 '   <td>'+(i+1)+'</td>\n' +
                 '   <td>'+rel.storename+'</td>\n' +
                 '   <td>'+rel.orderid+'</td>\n' +
                 '   <td>'+rel.num+'</td>\n' +
                 '   <td>￥'+rel.money+'</td>\n' +
                 '   <td>'+rel.instoredate+'</td>\n' +
                 '   <td>'+rel.uname+'</td>\n' +
                 '   <td>\n' +
                 '     <a href="../../storage/stock/stockView.html" class="tablelink">查看详情</a>\n' +
                 '   </td>\n' +
                 '</tr>';
        }
        $("#tb").html(str);
        $('.tablelist tbody tr:odd').addClass('odd');

        /*分页会了，经过李哥的教导*/
        layui.use("laypage", function () {
          var laypage = layui.laypage;
          laypage.render({
            elem: "page",                       //页码所放的位置，div标签的id
            count: totalcount,             	    //总记录数
            limit: pagesize,                    //每页的数据
            limits: [5, 8, 12],                 //每页可访问的数据量，可供用户选择
            curr: pagenum,                      //当前页
            layout: ['prev', 'page', 'next', 'limit', 'count'],
            //layout是改变分页布局的变量 prev:上一页 page:页码 next:下一页 limit:改分页长度下拉框 count:显示数据总量
            jump: function (obj, first) {		//监听分页按钮，按下时被调用
              pagenum = obj.curr		//获取改变的分页信息
              pagesize = obj.limit
              if (!first) {
                load(pagenum, pagesize);	//重新调用自己的加载页面的函数
              }
            }
          })
        })
      })
    };
	$('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
